package com.test.jogl;

import java.awt.geom.Point2D;

import com.test.game.tiles.DesertTile;
import com.test.game.tiles.EmptyTile;
import com.test.game.tiles.HexagonalTile;
import com.test.game.tiles.SeaTile;
import com.test.game.tiles.TileVisitor;
import com.test.game.tiles.ports.ClayPortTile;
import com.test.game.tiles.ports.OrePortTile;
import com.test.game.tiles.ports.SheepPortTile;
import com.test.game.tiles.ports.UndefinedPortTile;
import com.test.game.tiles.ports.WheatPortTile;
import com.test.game.tiles.ports.WoodPortTile;
import com.test.game.tiles.resources.ClayTile;
import com.test.game.tiles.resources.OreTile;
import com.test.game.tiles.resources.SheepTile;
import com.test.game.tiles.resources.WheatTile;
import com.test.game.tiles.resources.WoodTile;

public class HexagonalTileUI implements TileVisitor {

   private HexagonalTile tile;
   private Point2D.Float center;
   private float[] color;

   public HexagonalTileUI(HexagonalTile tileVal, Point2D.Float centerVal) {
      this.tile = tileVal;
      this.tile.accept(this);
      this.center = centerVal;
   }
   
   public HexagonalTile getTile() {
      return tile;
   }
   public void setTile(HexagonalTile tile) {
      this.tile = tile;
   }
   public Point2D.Float getCenter() {
      return center;
   }
   public void setCenter(Point2D.Float center) {
      this.center = center;
   }

   public float[] getColor() {
      return color;
   }

   public void setColor(float[] color) {
      this.color = color;
   }
      
   @Override
   public void visit(ClayPortTile clayPort) {
      this.color = new float[]{ 0.7529F, 0.7529F, 0.7529F, 1.0F };
   }

   @Override
   public void visit(OrePortTile orePort) {
      this.color = new float[]{ 0.7529F, 0.7529F, 0.7529F, 1.0F };
   }

   @Override
   public void visit(SheepPortTile sheepPort) {
      this.color = new float[]{ 0.7529F, 0.7529F, 0.7529F, 1.0F };
   }

   @Override
   public void visit(WheatPortTile wheatPort) {
      this.color = new float[]{ 0.7529F, 0.7529F, 0.7529F, 1.0F };
   }

   @Override
   public void visit(WoodPortTile woodPort) {
      this.color = new float[]{ 0.7529F, 0.7529F, 0.7529F, 1.0F };
   }

   @Override
   public void visit(UndefinedPortTile undefinedPort) {
      this.color = new float[]{ 0.7529F, 0.7529F, 0.7529F, 1.0F };
   }

   @Override
   public void visit(ClayTile clay) {
      this.color = new float[]{ 0.5019F, 0.2509F, 0.0000F, 1.0F };
   }

   @Override
   public void visit(OreTile ore) {
      this.color = new float[]{ 0.5019F, 0.5019F, 0.5019F, 1.0F };
   }

   @Override
   public void visit(SheepTile sheep) {
      this.color = new float[]{ 0.1490F, 0.6000F, 0.1254F, 1.0F };
   }

   @Override
   public void visit(WheatTile wheat) {
      this.color = new float[]{ 0.8666f, 0.8666f, 0.0000f, 1.0f };
   }

   @Override
   public void visit(WoodTile wood) {
      this.color = new float[]{ 0.2392F, 0.4627F, 0.0705F, 1.0F };
   }

   @Override
   public void visit(DesertTile desert) {
      this.color = new float[]{ 1.0000F, 1.0000F, 0.5490F, 1.0F };
   }

   @Override
   public void visit(EmptyTile empty) {
      this.color = new float[]{ 0.0000F, 0.0000F, 0.0000F, 1.0F };
   }

   @Override
   public void visit(SeaTile sea) {
      this.color = new float[]{ 0.0784F, 0.0274F, 1.6941F, 1.0F };
   }
   
}
